<?php

/*
 *Copyright (C), WhiteBlue
 *File name: bootstrap.php
 *Author: Version: 2015.3.9
 *Description: 启动(各种const的定义)
 */

class bootstrap
{
    public static function boot()
    {
        ob_start();
        require('config.php');
        if(config('isDebug')==true)
            error_reporting(E_COMPILE_ERROR||E_CORE_ERROR||E_ERROR);
        else
            error_reporting(0);
        $route = split("/", $_SERVER['PHP_SELF']);
        define('URL_BASE', $_SERVER['HTTP_HOST'] . '/' . $route[1] . '/index.php');
        define('BASE_PATH', $_SERVER['HTTP_HOST'] . '/' . $route[1]);
        define('FILE_PATH', dirname(dirname(__DIR__)));
        define('ASSET_PATH', BASE_PATH . '/app/assets');
        define('VIEW_PATH', FILE_PATH . '/app/views/');

        $whoops = new \Whoops\Run;
        $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
        $whoops->register();
        unset($whoops);
    }
}
